package com.sy.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sy.PageVO;
import com.sy.dto.CoursesPageByUserDTO;
import com.sy.dto.CoursesPageDTO;
import com.sy.mapper.ChaptersMapper;
import com.sy.mapper.CoursesMapper;
import com.sy.mapper.SectionsMapper;
import com.sy.pojo.Chapters;
import com.sy.pojo.Courses;
import com.sy.pojo.Sections;
import com.sy.service.CoursesService;
import com.sy.service.SectionsService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @className: SectionsServiceImpl
 * @author: Mr.Liu
 * @date: 2025/10/29 13:57
 * @Version: 1.0
 * @description:小节业务操作实现
 */
@Service
public class SectionsServiceImpl extends ServiceImpl<SectionsMapper, Sections> implements SectionsService {
   @Resource
    private SectionsMapper sectionsMapper;
    @Override
    public boolean updateSections(Map<String, Object> map) {
        int i = sectionsMapper.update(
                new UpdateWrapper<Sections>()
                        .eq("id", map.get("id"))
                        .set("free", "false".equals(map.get("free"))?0:1)
        );
        return i>0;
    }
}
